Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

gh-162462: Require canonical Windows code page names - #162483

Open
qventymr wants to merge 2 commits into
python:mainfrom
qventymr:fix/gh-162462
Open

qventymr wants to merge 2 commits into
python:mainfrom
qventymr:fix/gh-162462

Conversation

@qventymr

@qventymr qventymr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #162462.

The Windows code page search function used int() to parse the numeric
suffix. Alternate spellings of the same code page could create separate
entries in the codec registry.

Require ASCII decimal digits without leading zeros in the Windows code
page search function. Test that invalid spellings raise LookupError
and that CP0 and windows-1252 still resolve.

On Windows x64 Debug, ran test_codecs, test_codeccallbacks, and
test_multibytecodec.

Validate the numeric suffix before converting it to a code page number.
The codec registry caches successful lookups by name, so alternate
spellings of the same number can create duplicate codec entries.
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #36104691 | 📁 Comparing 4313d6a against main (22691a3)

  🔍 Preview build  

2 files changed
± library/codecs.html
± whatsnew/changelog.html

Comment thread Doc/library/codecs.rst Resolved
Comment thread Lib/test/test_codecs.py Resolved
@qventymr
qventymr requested a review from aisk November 27, 2026 15:47
@aisk aisk added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: non-canonical cpXXX names (cp01252, cp1_252) each cache a new codec

2 participants